<?php

namespace App\Console\Commands;

use App\Console\Base;
use App\Services\BkgeService;
use common\enum\ActiveEnum;
use common\enum\AgentMoneyLogEnum;
use common\enum\CommonEnum;
use common\enum\MoneyDepositEnum;
use common\enum\MoneyLogEnum;
use common\enum\MoneyWithdrawEnum;
use Illuminate\Support\Facades\DB;

class BkgeProcesser extends Base
{
    /**
     * 控制台命令 signature 的名称。
     *
     * @var string
     */
    protected $signature = self::PREFIX . 'handerAgentBkge {--hall_id=}';

    /**
     * 控制台命令说明。
     *
     * @var string
     */
    protected $description = '退佣统计';


    /**
     * 执行控制台命令。
     *
     * @return mixed
     */
    public function handle()
    {
        $hall_id = $this->option('hall_id');
        $this->info(date("Y-m-d H:i:s") . ':执行代理退佣统计,厅id为：' . $hall_id);
        $insertData = [];//获取的数据
        $currend_period_info = BkgeService::getPeriodInfo($hall_id);
        if (empty($currend_period_info)) {
            return false;
        }
        $handle_time = date("Y-m-d", strtotime("-1 day"));//统计时间
        $sysConfig = BkgeService::getSysSeting($hall_id);
        $is_auto_send_bkge = $sysConfig['send_type'] == 1 ? true : false;//是否自动发放
        $auto_amount_min = intval($sysConfig['auto_amount_min']);//自动发放最小金额
        $agentList = BkgeService::getAgentList($hall_id);//获取当天需要执行返佣计算的代理ID
        if (empty($agentList)) {
            return false;
        }

        foreach ($agentList as $value) {
            $agent_id = $value['id'];
            $agent_info = BkgeService::getAgentInfo($agent_id);

            //  ================================================ 初始化总公司输赢、总有效投注===================================

            $total_valid_bet = 0;    //总投注 （本期+往期）
            $total_totalprofit = 0; //总输赢（本期+往期）

            $total_validbet_egame = 0;// 电子有效投注（本期+往期）
            $total_validbet_live = 0;//视讯有效投注（本期+往期）
            $total_validbet_sport = 0;//体育有效投注（本期+往期）
            $total_validbet_esport = 0;//电竞有效投注（本期+往期）
            $total_validbet_caipiao = 0;//彩票有效投注（本期+往期）
            $total_validbet_qipai = 0;//棋牌有效投注（本期+往期）

            $total_profit_egame = 0;// 电子总输赢（本期+往期）
            $total_profit_live = 0;//视讯总输赢（本期+往期）
            $total_profit_sport = 0;//体育总输赢（本期+往期）
            $total_profit_esport = 0;//电竞总输赢（本期+往期）
            $total_profit_caipiao = 0;//彩票总输赢（本期+往期）
            $total_profit_qipai = 0;//棋牌总输赢（本期+往期）

            $toal_fee = 0; //总费用

            $total_bet_times = 0;//总有效投注数（本期+往期）
            $total_bet_amount = 0;//总投资金金额（本期+往期）

            //获取有效用户的配置
            $valid_user_config = BkgeService::getValidConfig($hall_id);

            //获取该期有效会员数
            $current_valid_user = BkgeService::getOfflineAgentValidCount($agent_id, $currend_period_info, $hall_id,$valid_user_config);

            // 获取本期总输赢，视讯，电竞，体验，电子，棋牌，彩票，有效投注
            $allBetInfo = BkgeService::getGameDate($agent_id, $currend_period_info, $hall_id);


            $current_total_valid_bet = $allBetInfo['totalvalidbet'];  //本期有效投注

            $current_total_profit = $allBetInfo['totalprofit'];//本期总输赢s

            $total_valid_bet += $current_total_valid_bet;

            //总输赢
            $total_totalprofit += $current_total_profit;

            //总投资金额
            $total_bet_amount += $allBetInfo['bet_amount_egame'] + $allBetInfo['bet_amount_live'] + $allBetInfo['bet_amount_sport'] + $allBetInfo['bet_amount_esport'] + $allBetInfo['bet_amount_caipiao'] + $allBetInfo['bet_amount_qipai'];

            // ================================================= 本期有效投注跟输赢  =============================================
            $current_validbet_egame = $allBetInfo['validbet_egame'];//本期电子有效投注
            $current_validbet_live = $allBetInfo['validbet_live'];//本期视讯有效投注
            $current_validbet_sport = $allBetInfo['validbet_sport'];//本期体育有效投注
            $current_validbet_esport = $allBetInfo['validbet_esport'];//本期电竞有效投注
            $current_validbet_caipiao = $allBetInfo['validbet_caipiao'];//本期彩票有效投注
            $current_validbet_qipai = $allBetInfo['validbet_qipai'];//本期棋牌有效投注


            $total_validbet_egame += $current_validbet_egame;
            $total_validbet_live += $current_validbet_live;
            $total_validbet_sport += $current_validbet_sport;
            $total_validbet_esport += $current_validbet_esport;
            $total_validbet_caipiao += $current_validbet_caipiao;
            $total_validbet_qipai += $current_validbet_qipai;


            $current_profit_egame = $allBetInfo['profit_egame'];//本期电子输赢
            $current_profit_live = $allBetInfo['profit_live'];//本期视讯输赢
            $current_profit_sport = $allBetInfo['profit_sport'];//本期体育输赢
            $current_profit_esport = $allBetInfo['profit_esport'];//本期电竞输赢
            $current_profit_caipiao = $allBetInfo['profit_caipiao'];//本期彩票输赢
            $current_profit_qipai = $allBetInfo['profit_qipai'];//本期棋牌输赢

            //当期总盈利
//            $current_total_profit=$current_profit_egame+$current_profit_live+$current_profit_sport+$current_profit_esport+$current_profit_caipiao+$current_profit_qipai;

            $total_profit_egame += $current_profit_egame;
            $total_profit_live += $current_profit_live;
            $total_profit_sport += $current_profit_sport;
            $total_profit_esport += $current_profit_esport;
            $total_profit_caipiao += $current_profit_caipiao;
            $total_profit_qipai += $current_profit_qipai;


            $total_bet_times += $allBetInfo['bet_times'];
            // ================================================= 往期有效投注跟输赢 =============================================
            $pre_validbet_egame = 0;//往期电子有效投注
            $pre_validbet_live = 0;//往期视讯有效投注
            $pre_validbet_sport = 0;//往期体育有效投注
            $pre_validbet_esport = 0;//往期电竞有效投注
            $pre_validbet_caipiao = 0;//往期彩票有效投注
            $pre_validbet_qipai = 0;//往期棋牌有效投注
            $pre_total_valid_bet = 0;//往期总有效投注

            $pre_profit_egame = 0;//往期电子输赢
            $pre_profit_live = 0;//往期视讯输赢
            $pre_profit_sport = 0;//往期体育输赢
            $pre_profit_esport = 0;//往期电竞输赢
            $pre_profit_caipiao = 0;//往期彩票输赢
            $pre_profit_qipai = 0;//往期棋牌输赢
            $pre_total_profit = 0;//往期总盈利

            // ================================================= 计算当期费用 =============================================
            //   总费用=手续费+返水优惠+其他优惠
            //入款总额：包括线上入款，线下入款，人工存提中的手动存款
            //入款类型
            $depositType = [
                MoneyDepositEnum::DEPOSIT_TYPE_COUNTER, MoneyDepositEnum::DEPOSIT_TYPE_ATM, MoneyDepositEnum::DEPOSIT_TYPE_AUTO_ATM,
                MoneyDepositEnum::DEPOSIT_TYPE_MOBILE, MoneyDepositEnum::DEPOSIT_TYPE_ALIPAY,
                MoneyDepositEnum::DEPOSIT_TYPE_TENPAY, MoneyDepositEnum::DEPOSIT_TYPE_WECHAT,
                MoneyDepositEnum::DEPOSIT_TYPE_MANUAL, MoneyDepositEnum::DEPOSIT_TYPE_CYBER_BANK];
            $current_deposit_money = BkgeService::getMoneyDepositLog($agent_id, $depositType, $currend_period_info, $hall_id);//线下入款+人工存提
            $current_deposit_money += BkgeService::getMoneyDepositLog($agent_id, [], $currend_period_info, $hall_id, 1);//线上入款


            //出款总额：包括会员提款，人工存提中的手动提款
            //出款类型
            $withdrawType = [MoneyWithdrawEnum::WITHDRAW_TYPE_USER_APPLY, MoneyWithdrawEnum::WITHDRAW_TYPE_MANUAL];
            $current_withdraw_money = BkgeService::getMoneyWithdrawLog($agent_id, $withdrawType, $currend_period_info, $hall_id);//代理会员出款

            //返水类型
            //返水=返水活动金额+人工存提中发放返水
            $revertTpe = [MoneyDepositEnum::DEPOSIT_TYPE_MANUAL_REBATE];
            $activityRebet=[ActiveEnum::ACTIVE_BACKWATER];
            $current_fanshui_money = BkgeService::getMoneyDepositLog($agent_id, $revertTpe, $currend_period_info, $hall_id,0,'coupon_amount');//人工存提发放返水
            $current_fanshui_money+= BkgeService::getActivityMoney($agent_id, $currend_period_info, $hall_id,$activityRebet);//返水活动发放返水

            //优惠类型
            //：其他优惠=常规活动优惠金额+自定义活动优惠金额+人工存提中发放优惠+人工存提中手动存款优惠金额
            $couponType = [MoneyDepositEnum::DEPOSIT_TYPE_MANUAL_COUPON];
            $current_youhui_money = BkgeService::getMoneyDepositLog($agent_id, $couponType, $currend_period_info, $hall_id,0,'coupon_amount');//人工存提发放优惠

            $couponTypeRecharge = [MoneyDepositEnum::DEPOSIT_TYPE_MANUAL];
            $current_youhui_money += BkgeService::getMoneyDepositLog($agent_id, $couponTypeRecharge, $currend_period_info, $hall_id, 0, 'coupon_amount');//人工存提中手动存款优惠金额

            $activityType=[
                ActiveEnum::ACTIVE_EVERY_DAY_DEPOSIT,
                ActiveEnum::ACTIVE_MAILBOX_VERIFICATION,
                ActiveEnum::ACTIVE_PHONE_VERIFICATION,
                ActiveEnum::ACTIVE_EVERY_DAY_LOTTERY,
                ActiveEnum::ACTIVE_RESCUE_PRIZE,
                ActiveEnum::ACTIVE_PLATFORM_PRIZE,
                ActiveEnum::ACTIVE_PRIZE_ON_PRIZE,
                ActiveEnum::ACTIVE_CONTINUOUS_PASS,
                ActiveEnum::ACTIVE_RECHARGE_OFFER,
                ActiveEnum::ACTIVE_REGISTERED_OFFER,
                ActiveEnum::ACTIVE_EVERY_DAY_SIGN,
                ActiveEnum::ACTIVE_EVERY_DAY_BET,
                ActiveEnum::ACTIVITY_CUSTOM
            ];
            $current_youhui_money += BkgeService::getActivityMoney($agent_id, $currend_period_info, $hall_id, $activityType);//常规活动跟自定义活动优惠金额




            //获取本期的手续设置
            $current_fee_config = BkgeService::getFeeConfig($hall_id);

            //获取当期出入款手续费
            $current_fee = BkgeService::getOrgFee($current_deposit_money, $current_withdraw_money, $current_fee_config);

            //本期总费用
            $current_total_fee = $current_fee + $current_fanshui_money + $current_youhui_money;

            $toal_fee += $current_total_fee;



            // ================================================= 初始化往期费用 =============================================

            $pre_deposit_money = 0;//初始化往期入款
            $pre_withdraw_money = 0;//初始化往期出款
            $pre_fanshui_money = 0;//初始化往期返水款
            $pre_rebet_money = 0;//初始化往期退水
            $pre_youhui_money = 0;//初始化往期优惠款
            $pre_total_fee = 0;//初始化往期总费用


            //===============================================此处需要将会员输赢转为对应的公司输赢====================================

            $current_profit_egame = -$current_profit_egame;//本期公司电子输赢
            $current_profit_live = -$current_profit_live;//本期公司视讯输赢
            $current_profit_sport = -$current_profit_sport;//本期公司体育输赢
            $current_profit_esport = -$current_profit_esport;//本期公司电竞输赢
            $current_profit_caipiao = -$current_profit_caipiao;//本期公司彩票输赢
            $current_profit_qipai = -$current_profit_qipai;//本期公司棋牌输赢
            $current_total_profit = -$current_total_profit;//本期总输赢


            $total_profit_egame = -$total_profit_egame;// 电子总输赢（本期+往期）
            $total_profit_live = -$total_profit_live;//视讯总输赢（本期+往期）
            $total_profit_sport = -$total_profit_sport;//体育总输赢（本期+往期）
            $total_profit_esport = -$total_profit_esport;//电竞总输赢（本期+往期）
            $total_profit_caipiao = -$total_profit_caipiao;//彩票总输赢（本期+往期）
            $total_profit_qipai = -$total_profit_qipai;//棋牌总输赢（本期+往期）
            $total_totalprofit = -$total_totalprofit;//总输赢

            //==================================================== 判断是否有往期的数据了==========================================

            $status = 0;//初始化本期数据的状态

            $last_period_data = BkgeService::LastPeriodData($agent_id, $hall_id);
            if (!empty($last_period_data)) {

                //往期有效投注
                $pre_validbet_egame += $last_period_data['current_validbet_egame'] + $last_period_data['previous_validbet_egame'];
                $pre_validbet_live += $last_period_data['current_validbet_video'] + $last_period_data['previous_validbet_video'];
                $pre_validbet_sport += $last_period_data['current_validbet_sport'] + $last_period_data['previous_validbet_sport'];
                $pre_validbet_esport += $last_period_data['current_validbet_esport'] + $last_period_data['previous_validbet_esport'];
                $pre_validbet_caipiao += $last_period_data['current_validbet_lottery'] + $last_period_data['previous_validbet_lottery'];
                $pre_validbet_qipai += $last_period_data['current_validbet_card'] + $last_period_data['previous_validbet_card'];

                //没类总有效投注
                $total_validbet_egame += $pre_validbet_egame;
                $total_validbet_live += $pre_validbet_live;
                $total_validbet_sport += $pre_validbet_sport;
                $total_validbet_esport += $pre_validbet_esport;
                $total_validbet_caipiao += $pre_validbet_caipiao;
                $total_validbet_qipai += $pre_validbet_qipai;

                //往期总有效投注
                $pre_total_valid_bet += $pre_validbet_egame + $pre_validbet_live + $pre_validbet_sport + $pre_validbet_esport + $pre_validbet_caipiao + $pre_validbet_qipai;
                //本期+往期总有效投注
                $total_valid_bet += $pre_total_valid_bet;


                //往期费用
                $pre_deposit_money += $last_period_data['current_deposit_amount'] + $last_period_data['previous_deposit_amount'];//往期入款
                $pre_withdraw_money += $last_period_data['current_withdraw_amount'] + $last_period_data['previous_withdraw_amount'];//往期提现
                $pre_rebet_money += $last_period_data['current_rebet_amount'] + $last_period_data['previous_rebet_amount'];//往期退水
                $pre_fanshui_money += $last_period_data['previous_reverse_amount'] + $last_period_data['current_reverse_amount'];//往期返水
                $pre_youhui_money += $last_period_data['current_coupon_amount'] + $last_period_data['previous_coupon_amount'];//往期优惠

                $pre_total_fee += $last_period_data['current_fee_amount'] + $last_period_data['previous_fee_amount'];//往期总费用

                $toal_fee += $pre_total_fee;


                //初始化往期输赢
                $pre_profit_egame += $last_period_data['current_profit_egame'] + $last_period_data['previous_profit_egame'];
                $pre_profit_live += $last_period_data['current_profit_video'] + $last_period_data['previous_profit_video'];
                $pre_profit_sport += $last_period_data['current_profit_sport'] + $last_period_data['previous_profit_sport'];
                $pre_profit_esport += $last_period_data['current_profit_esport'] + $last_period_data['previous_profit_esport'];
                $pre_profit_caipiao += $last_period_data['current_profit_lottery'] + $last_period_data['previous_profit_lottery'];
                $pre_profit_qipai += $last_period_data['current_profit_card'] + $last_period_data['previous_profit_card'];

                $total_profit_egame += $pre_profit_egame;
                $total_profit_live += $pre_profit_live;
                $total_profit_sport += $pre_profit_sport;
                $total_profit_esport += $pre_profit_esport;
                $total_profit_caipiao += $pre_profit_caipiao;
                $total_profit_qipai += $pre_profit_qipai;


                //往期总盈利
                $pre_total_profit += $pre_profit_egame + $pre_profit_live + $pre_profit_sport + $pre_profit_esport + $pre_profit_caipiao + $pre_profit_qipai;

                //(本期+往期)总输赢
                $total_totalprofit += $pre_total_profit;
                //总投注数
                $total_bet_times += $last_period_data['total_bet_times'];
                //总投注金额
                $total_bet_amount += $last_period_data['total_bet_amount'];
            }


            //=====================================================计算退水==============================================

            //退水=各类类型总有效投注*手续费比例
            //==============================================计算本期退水===========================================
            //获取本期退水比例
            $current_rebet_setting = BkgeService::getCurrentRebetRate($agent_info, $total_valid_bet, $hall_id);

            //计算退水(累计往期数据开始计算的)
            $current_rebet_money = BkgeService::getCurrentRebetMoney($current_rebet_setting, $total_validbet_egame, $total_validbet_live, $total_validbet_sport, $total_validbet_esport, $total_validbet_caipiao, $total_validbet_qipai);

//            $total_rebet_money = $current_rebet_money + $pre_rebet_money;//总退水

            //=====================================================计算剩余费用==============================================

            $current_fee_amount_yue = $toal_fee - $current_rebet_money > 0 ? $toal_fee - $current_rebet_money : 0;


            //=====================================================计算各类游戏输赢==============================================

            //获取当前退佣模板
            $current_bkge_setting = BkgeService::getCurrentBkgeRate($agent_info, $total_totalprofit, $current_valid_user, $total_valid_bet, $hall_id);

            //计算本期该发放的退佣佣金
            $bkge_money = BkgeService::currentBkgeMoney($current_bkge_setting, $current_fee_amount_yue, $total_profit_egame, $total_profit_live, $total_profit_sport, $total_profit_esport, $total_profit_caipiao, $total_profit_qipai);
            //判断是不是自动发放
            if ($is_auto_send_bkge) {
                if ($bkge_money > 0 && $bkge_money >= $auto_amount_min) {//自动发放金额
                    DB::beginTransaction();
                    try {
                        $agent_money = DB::select("select * from agent_money where hall_id=" . $agent_info['hall_id'] . " and agent_id=" . $agent_id . "  for update");
                        $agent_money = json_decode(json_encode($agent_money[0]), true);
                        $send_status = BkgeService::autoSendBage($agent_info, $bkge_money);
                        if (!$send_status || $send_status === false) {
                            $this->info("统计时间为：" . $handle_time . "自动发放失败,期数信息为:" . json_encode($currend_period_info, JSON_UNESCAPED_UNICODE));
                            DB::rollBack();
                        } else {
                            //新增流水记录
                            $log_data['hall_id'] = $agent_info['hall_id'];
                            $log_data['agent_id'] = $agent_info['id'];
                            $log_data['agent_name'] = $agent_info['agent_name'];
                            $log_data['order_number'] = date("YmdHis") . $currend_period_info['agent_period_name'];
                            $log_data['category'] = AgentMoneyLogEnum::AGENT_MONEY_INCOME;
                            $log_data['type'] = AgentMoneyLogEnum::AGENT_DEPOSIT_CHARGES;
                            $log_data['amount']=$bkge_money;
                            $log_data['balance'] = $agent_money['balance'] + $bkge_money;
                            $log_data['balance_before'] = $agent_money['balance'];
                            $log_data['remark'] = "代理第" . $currend_period_info['agent_period_name'] . "期自动发放退佣佣金" . $bkge_money/CommonEnum::MONEY_RATE;
                            $log_status = BkgeService::addBkgeMoneyLog($log_data);
                            if (!$log_status || $log_status === false) {
                                DB::rollBack();
                                $this->info("统计时间为：" . $handle_time . "自动发放添加记录失败失败,期数信息为:" . json_encode($currend_period_info, JSON_UNESCAPED_UNICODE));
                            } else {
                                DB::commit();
                                $status = 1;
                            }
                        }
                    } catch (\Throwable $e) {
                        $this->info($e->getMessage());
                        DB::rollBack();
                    }

                }
            }
            $insertData[] = [
                'hall_id' => $agent_info['hall_id'],
                'period_id' => $currend_period_info['id'],
                'agent_id' => $agent_id,
                'agent_name' => $agent_info['agent_name'],
                'total_valid_user' => $current_valid_user,
                'total_bet_times' => $total_bet_times,
                'total_bet_amount' => $total_bet_amount,
                'total_validbet_amount' => $total_valid_bet,
                'total_profit_amount' => $total_totalprofit,
                'total_bkge_amount' => $bkge_money,
                'lottery_bkge_per' => $current_bkge_setting['lottery_per'],
                'egame_bkge_per' => $current_bkge_setting['egame_per'],
                'sport_bkge_per' => $current_bkge_setting['sport_per'],
                'video_bkge_per' => $current_bkge_setting['video_per'],
                'esport_bkge_per' => $current_bkge_setting['esport_per'],
                'card_bkge_per' => $current_bkge_setting['card_per'],
                'lottery_rebet_per' => $current_rebet_setting['lottery_per'],
                'egame_rebet_per' => $current_rebet_setting['egame_per'],
                'sport_rebet_per' => $current_rebet_setting['sport_per'],
                'video_rebet_per' => $current_rebet_setting['video_per'],
                'esport_rebet_per' => $current_rebet_setting['esport_per'],
                'card_rebet_per' => $current_rebet_setting['card_per'],
                'deposit_fee_per' => $current_fee_config['deposit_fee_per'],
                'withdraw_fee_per' => $current_fee_config['withdraw_fee_per'],
                'current_validbet_lottery' => $current_validbet_caipiao,
                'current_validbet_egame' => $current_validbet_egame,
                'current_validbet_sport' => $current_validbet_sport,
                'current_validbet_video' => $current_validbet_live,
                'current_validbet_esport' => $current_validbet_esport,
                'current_validbet_card' => $current_validbet_qipai,
                'current_validbet_amount' => $current_total_valid_bet,
                'current_profit_lottery' => $current_profit_caipiao,
                'current_profit_egame' => $current_profit_egame,
                'current_profit_sport' => $current_profit_sport,
                'current_profit_video' => $current_profit_live,
                'current_profit_esport' => $current_profit_esport,
                'current_profit_card' => $current_profit_qipai,
                'current_prifit_amount' => $current_total_profit,
                'current_fee_amount' => $current_total_fee,
                'current_deposit_amount' => $current_deposit_money,
                'current_withdraw_amount' => $current_withdraw_money,
                'current_coupon_amount' => $current_youhui_money,
                'current_rebet_amount' => $current_rebet_money,//
                'current_reverse_amount' => $current_fanshui_money,
                'previous_validbet_lottery' => $pre_validbet_caipiao,
                'previous_validbet_egame' => $pre_validbet_egame,
                'previous_validbet_sport' => $pre_validbet_sport,
                'previous_validbet_video' => $pre_validbet_live,
                'previous_validbet_esport' => $pre_validbet_esport,
                'previous_validbet_card' => $pre_validbet_qipai,
                'previous_validbet_amount' => $pre_total_valid_bet,
                'previous_profit_lottery' => $pre_profit_caipiao,
                'previous_profit_egame' => $pre_profit_egame,
                'previous_profit_sport' => $pre_profit_sport,
                'previous_profit_video' => $pre_profit_live,
                'previous_profit_esport' => $pre_profit_esport,
                'previous_profit_card' => $pre_profit_qipai,
                'previous_prifit_amount' => $pre_total_profit,
                'previous_fee_amount' => $pre_total_fee,
                'previous_deposit_amount' => $pre_deposit_money,
                'previous_withdraw_amount' => $pre_withdraw_money,
                'previous_coupon_amount' => $pre_youhui_money,
                'previous_rebet_amount' => $pre_rebet_money,//往期退水
                'previous_reverse_amount' => $pre_fanshui_money,
                'status' => $status,
                'setting'=>json_encode($valid_user_config,320)
            ];

        }
        $fee_status = BkgeService::addSettingLog($currend_period_info['id'], $current_fee_config, $hall_id);
        if ($fee_status === false || !$fee_status) {
            $this->error("统计时间为：" . $handle_time . "修改费率设置失败,期数信息为:" . json_encode($currend_period_info, JSON_UNESCAPED_UNICODE));
        }
        if (!empty($insertData)) {
            BkgeService::addBkgeLog($insertData);
        }
        $status = BkgeService::updatePerionStatus($currend_period_info['id'], $hall_id);
        if ($status === false || !$status) {
            $this->error("统计时间为：" . $handle_time . "修改统计状态失败,期数信息为:" . json_encode($currend_period_info, JSON_UNESCAPED_UNICODE));
        }


    }


}
